package models
{
	import events.XMLDataEvent;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.net.URLLoader;
	import flash.net.URLRequest;

	public class XMLDataModel extends EventDispatcher
	{
		public static const DATA_URL:String="playlist.xml";
		private var _XMLLoader:URLLoader;
		public var dataXML:XML;
		public function XMLDataModel()
		{
			init();
		}
		private function init():void
		{
			_XMLLoader=new URLLoader();
			_XMLLoader.addEventListener(Event.COMPLETE,loadComplete);
			_XMLLoader.load(new URLRequest(DATA_URL));
		}
		private function loadComplete(evt:Event):void
		{
			dataXML=new XML(evt.target.data);
			dispatchEvent(new XMLDataEvent(XMLDataEvent.XML_LOADED));
		}
	}
}